Application Commands
Application commands are commands that cause actions in scriptable applications. The target of an application command is an application object
or a script object. Different application objects respond to different commands. To determine which commands a particular object can respond to, see the definitions provided by the application's documentation. (For example, each object definition in Appendix B, "Scriptable Text Editor Dictionary," of this book includes a list of commands that can act on that object.)There are two ways to specify an object as the target of a command: in the direct parameter of the command or in a Tell statement that contains
the command.The direct parameter is a value, usually a reference, that appears immediately after a command and specifies the target of the command. Not all commands can have a direct parameter. If a command can have a direct parameter, the command's definition says so.
For example, in the following statement, the reference
word 1 of front document of app "Scriptable Text Editor"
is the direct parameter of the Delete command:
delete word 1 of front document of app "Scriptable Text Editor"A Tell statement is a statement that specifies a default target for all commands contained within it. If a command is contained within a Tell statement, the direct parameter is optional. If you leave out the direct parameter, AppleScript uses the default target specified in the Tell statement. For example, the Delete command in the following Tell statement has the same effect as the Delete command in the previous example:
tell word 1 of front document of app "Scriptable Text Editor" delete end tellSimilarly, if you specify a reference incompletely in the command line, AppleScript uses the default target specified in the enclosing Tell statement
to complete the reference. For example, the following statement is equivalent
to both of the previous examples:
tell front document of app "Scriptable Text Editor" delete word 1 end tellFor information about sending application commands to script objects, see Chapter 9, "Script Objects," which begins on page 265.